{
  "$schema" : "http://json-schema.org/draft/2019-09/schema#",
  "title" : "Direct Debit Mandates Extract",
  "type" : "object",
  "additionalProperties" : false,
  "properties" : {
    "identifier" : {
      "type" : "integer",
      "description" : "Unique identifier for each file that is produced or processed by CMP"
    },
    "version" : {
      "type" : "number",
      "minimum" : 0.0,
      "maximum" : 99.99,
      "description" : "The current version of the generic extract file. This must match the corresponding inbound file."
    },
    "interfaceCategory" : {
      "type" : "string",
      "enum" : [ "Payments" ],
      "description" : "CMP categorisation of the job associated with this file"
    },
    "interfaceType" : {
      "type" : "string",
      "enum" : [ "Mandates" ],
      "description" : "Sub-categorisation of the job"
    },
    "batchDateAndTime" : {
      "type" : "string",
      "format" : "date-time",
      "description" : "Represents when a batch was created in CMP"
    },
    "extractDateAndTime" : {
      "type" : "string",
      "format" : "date-time",
      "description" : "Represents when a generic CMP file was created from a batch"
    },
    "recordCount" : {
      "type" : "integer",
      "description" : "Total number of transaction records in the extract file"
    },
    "details" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/DirectDebitMandatesExtractDetail"
      }
    }
  },
  "required" : [ "identifier", "version", "interfaceCategory", "interfaceType", "batchDateAndTime", "extractDateAndTime", "recordCount" ],
  "definitions" : {
    "DirectDebitMandatesExtractDetail" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "detailSequence" : {
          "type" : "integer",
          "description" : "Unique identifier of the detail record within the current extract"
        },
        "accountNumber" : {
          "type" : "integer",
          "description" : "Unique identifier of the account in CMP"
        },
        "mandateReference" : {
          "type" : "string",
          "maxLength" : 50,
          "description" : "Mandate reference for bank payment detail"
        },
        "nameOfPayer" : {
          "type" : "string",
          "maxLength" : 50,
          "description" : "Name of payer information"
        },
        "bankIdentifier" : {
          "type" : "string",
          "maxLength" : 20,
          "description" : "Bank identifier"
        },
        "bankAccountIdentifier" : {
          "type" : "string",
          "maxLength" : 40,
          "description" : "Bank account identifier"
        }
      },
      "required" : [ "detailSequence", "accountNumber", "mandateReference", "nameOfPayer", "bankIdentifier", "bankAccountIdentifier" ]
    }
  }
}